/* 
   Copyright(C)2012 Fredy Ramirez - www.pacificcoolwave.com
 
   This file is part of the TerraCool project.
	
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

using System;
using System.Globalization;
using System.Xml;

namespace Pcw.TerraCool
{
	/// <summary>
	/// Source file type that TerraCool supports.
	/// </summary>
	public enum SourceType 
	{
		csharp,
		vb,
		NotDefined
	}

	/// <summary>
	/// Static Catalog.
	/// </summary>
	public static class TerraCool
	{
		static Catalog catalog;

		/// <summary>
		/// Initializes a static instance of the <see cref="Pcw.TerraCool.Catalog"/> class.
		/// </summary>
		/// <param name='neutralXmlLocale'>Neutral xml locale.</param>
		/// <param name='specificXmlLocale'>Specific xml locale.</param>
		public static void Init(XmlDocument neutralXmlLocale, XmlDocument specificXmlLocale) 
		{
			catalog = new Catalog(neutralXmlLocale, specificXmlLocale);
		}

		/// <summary>
		/// Initializes a new static instance of the <see cref="Pcw.TerraCool.Catalog"/> class.
		/// </summary>
		/// <param name='packageName'>Package name.</param>
		/// <param name='localeDir'>Locale dir.</param>
		public static void Init (string packageName, string localeDir)
		{
			catalog = new Catalog(packageName, localeDir);
		}

		/// <summary>
		/// Gets or sets the catalog culture info.
		/// </summary>
		/// <value>
		/// The catalog culture info.
		/// </value>
		public static CultureInfo CatalogCultureInfo {
			get {
				return catalog.CatalogCultureInfo;
			}
			set {
				catalog.CatalogCultureInfo = value;	
			}
		}

		/// <summary>
		/// Gets the catalog object.
		/// </summary>
		/// <value>
		/// The catalog.
		/// </value>
		public static Catalog Catalog {
			get {return catalog;}
		}

		/// <summary>
		/// Gets the translated string.
		/// </summary>
		/// <returns>The translated string.</returns>
		/// <param name='strId'>String to translate.</param>
		public static string GetString(string strId) 
		{
			return catalog.GetString(strId);
		}

		/// <summary>
		/// Gets the translated plural string.
		/// </summary>
		/// <returns>
		/// The plural or single translated string.
		/// </returns>
		/// <param name='singleString'>Single string.</param>
		/// <param name='pluralString'>Plural string.</param>
		/// <param name='n'>Integer that determines which string to process (single or plural). 
		/// If 'n' is less than one it uses single, otherwise plural.
		/// </param>
		public static string GetPluralString(string singleString, string pluralString, int n) 
		{
			return catalog.GetPluralString(singleString, pluralString, n);
		}
	}
}















